import java.util.Arrays;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: lenovo
 * Date: 2023 -04 -02
 * Time: 13:36
 */
public class Solution {
    public int missingNumber(int[] nums) {
        Arrays.sort(nums);
        Arrays.sort(nums);
        for(int i=0;i<nums.length;i++){
            if(nums[i]!=i){
                return i;
            }
        }
        return nums.length;
    }

    public static void main(String[] args) {
        int[] nums=new int[3];
        nums[0]=3;
        nums[1]=0;
        nums[2]=1;
        Solution solution=new Solution();
        int ret=solution.missingNumber(nums);
        System.out.println(ret);
    }
}
